package Server.Database;

import java.sql.SQLException;

/**
 *
 * @author Paulius Dambrauskas
 */
public class SettingsRegister {

    private Database db;

    public SettingsRegister(Database db) {
        this.db = db;
    }

    public void setSettings(String setting, String value) throws SQLException {
        db.statement.executeUpdate("UPDATE automatics SET Value = '" + value + "' WHERE Setting = '" + setting + "'");
    }

    public String getSettingValue(String setting) throws SQLException {
        db.resultSet = db.statement.executeQuery("SELECT Value FROM automatics WHERE Setting = '" + setting + "'");
        db.resultSet.next();
        return db.resultSet.getString(1);
    }
}
